<?php

namespace App\Models;


use App\Service\Base\Model;

class CourseStudent extends Model
{

    // 上课的学员表
    protected $table = 'course_student';

    // 缓存字段，用于搜索绑定的字段
    protected $cacheFields = ['id', 'uid', 'course_id', 'student_id'];

    // {"id":"自编号","uid":"用户ID","course_id":"课程id","student_id":"学员ID","course_uid":"提醒用户","person_name":"用户名（唯一且不变，用于阿特@操作）","mobile":"手机号","status":"状态 0-未接入 1-正常接入 -1-删除","ctime":"注册时间","mtime":"更新时间"}


    // array ( 'id' => '$this->getData("id", null, "trim")', 'uid' => '$this->getData("uid", null, "trim")', 'course_id' => '$this->getData("course_id", null, "trim")', 'student_id' => '$this->getData("student_id", null, "trim")', 'course_uid' => '$this->getData("course_uid", null, "trim")', 'person_name' => '$this->getData("person_name", null, "trim")', 'mobile' => '$this->getData("mobile", null, "trim")', 'status' => '$this->getData("status", null, "trim")', 'ctime' => '$this->getData("ctime", null, "trim")', 'mtime' => '$this->getData("mtime", null, "trim")', )


    // $id = $this->getData("id", null, 'trim'); $uid = $this->getData("uid", null, 'trim'); $course_id = $this->getData("course_id", null, 'trim'); $student_id = $this->getData("student_id", null, 'trim'); $course_uid = $this->getData("course_uid", null, 'trim'); $person_name = $this->getData("person_name", null, 'trim'); $mobile = $this->getData("mobile", null, 'trim'); $status = $this->getData("status", null, 'trim'); $ctime = $this->getData("ctime", null, 'trim'); $mtime = $this->getData("mtime", null, 'trim');

    // 定义验证操作
    public function rules()
    {

        $add = [
            'uid'        => 'required',
        ];

        $edit = [
        ];

        $info = [
        ];


        $rule = [
            'course_id'  => 'required',
            'student_id' => 'required',
            //'course_uid' => 'required',
            //'person_name' => 'required',
            //'mobile'      => 'required',
            'status'     => ['in:-1,0,1,2'],
        ];


        $msg = [
            'id'          => '自编号',
            'uid'         => '用户ID',
            'course_id'   => '课程id',
            'student_id'  => '学员ID',
            'course_uid'  => '提醒用户',
            'person_name' => '用户名（唯一且不变，用于阿特@操作）',
            'mobile'      => '手机号',
            'status'      => '状态 0-未接入 1-正常接入 -1-删除',
            'ctime'       => '注册时间',
            'mtime'       => '更新时间',
        ];

        return ['rule' => $rule, 'msg' => $msg, 'add' => $add];
    }
}
